<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <!-- <script src="./lib/Promise.js"></script> -->
  <!-- <script src="../Promise.js"></script> -->
  <script src="./lib/Promise_class.js"></script>
  <script>
    new Promise((resolve, reject) => {
      // resolve(1)
      reject(2)
    })
    .then(
      value => console.log('onResolved()1')
    )
    .then(
      value => console.log('onResolved()2', value),
      reason => {
        console.log('onRejected()2', reason)
        // return 3
        // throw 4
        return new Promise((resolve, reject) => {
          resolve(5)
          // reject(6)
        })
      }
    ).then(
      value => console.log('onResolved()3', value),
      reason => console.log('onRejected()3', reason)
    ).catch(
      reason => {
        console.log('onRejected()4', reason)
        return 7
      }
    ).then(
      value => console.log('onResolved()5', value)
    )
  </script>
</body>
</html>